package com.laicunba.event.listener;


import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import com.laicunba.event.WithdrawEvent;
import com.laicunba.pojo.FinancingTargetBidDO;
import com.laicunba.pojo.UserDO;
import com.laicunba.service.MobileMessageService;
import com.laicunba.service.TemplateService;
import com.laicunba.service.UserService;

@Component
public class ReinvestListener implements ApplicationListener<WithdrawEvent> {
	@Autowired
	private TemplateService templateService;
	@Autowired
	private MobileMessageService mobileMessageService;
	@Autowired
	private UserService userService;

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public void onApplicationEvent(WithdrawEvent event) {
//		if (event.getSource() instanceof FinancingTargetBidDO) {
//			FinancingTargetBidDO bid = (FinancingTargetBidDO) event.getSource();
//			if (!"ACTIVITY".equalsIgnoreCase(bid.getPayMark())) {
//				Map param = new HashMap();
//				String msg = templateService.simpleMerge("复投有礼！活动期间复投加息2%25！猛戳 http://8.laicunba.com/h5/activity/reinvest_activity.htm", param);
//				UserDO user = userService.get(UserDO.class, bid.getBidUserId());
//				mobileMessageService.sendMsgAsync(user.getMobile(), msg);
//			}
//		}
	}

}
